package com.hgq.tenadmin.sys.service.impl;

import com.hgq.tenadmin.sys.dao.UserDao;
import com.hgq.tenadmin.sys.service.UserService;
import com.hgq.tencommon.entity.sys.SysUser;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserDao userDao;
    @Override
    public SysUser login(String username,String password) {
        SysUser login = userDao.login(username);
//        System.out.println(username);
//        System.out.println(password);
        System.out.println(login);
        if (login==null){
            throw new RuntimeException("用户不存在");
        }
        if(!login.getPassword().equals(password)){
            throw new RuntimeException("用户密码不正确");
        }
        return login;
    }
}
